 /* Copyright 2018 JDCLOUD.COM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http:#www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

云硬盘API
云硬盘API包含云硬盘相关接口和快照相关接口。可提供批量创建云硬盘，删除云硬盘，制作云硬盘快照等功能。

OpenAPI spec version: v1
Contact: 

NOTE: This class is auto generated by the jdcloud code generator program.
*/


#import <Foundation/Foundation.h>
#import <JDCloudOCSDKDisk/DiskExecutor.h>

@implementation DiskClient

@synthesize userAgent = _userAgent;
@synthesize serviceName = _serviceName;
@synthesize version = _version;

-(void) addCustomerHeaderWithKey:(NSString*) key
                           value:(NSString*) value{
    if(![self customHeader])
    {
        self.customHeader = [[NSMutableDictionary alloc] init];
    }
    if(key && value)
    {
        [[self customHeader] setValue:value forKey:key];
    }
   
}

-(id)initWithGlobalConfig{
    if(![GlobalConfig credential])
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@"GlobalConfig credential not config" userInfo:nil];
        @throw e;
    }
    self.credential = [GlobalConfig credential];
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"disk.jdcloud-api.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 disk  v1";
    _serviceName = @"disk";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
         sdkEnvironment:(SDKEnvironment*)sdkEnvironment
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    
    if(!sdkEnvironment)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" sdkEnvironment can not null" userInfo:nil];
        @throw e;
    }else{
        self.sdkEnvironment = sdkEnvironment;
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 disk  v1";
    _serviceName = @"disk";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)initWithCredential:(Credential*)credential
{
    if(!credential)
    {
        NSException *e = [SDKArgumentNullException exceptionWithName:@"ArgumentNullException" reason:@" credential can not null" userInfo:nil];
        @throw e;
    }else{
        self.credential = credential;
    }
    if(![GlobalConfig sdkEnvironment])
    {
        self.sdkEnvironment = [[SDKEnvironment alloc] initWithEndPoint:@"disk.jdcloud-api.com"];
    }else
    {
        self.sdkEnvironment = [GlobalConfig sdkEnvironment];
    }
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 disk  v1";
    _serviceName = @"disk";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}

-(id)init{
    self.httpRequestProtocol = @"https";
    _userAgent = @"JdCloudOCSdk 0.0.1 disk  v1";
    _serviceName = @"disk";
    _version = @"v1";
    self.contentType = @"application/json";
    return self;
}


/**
modifySnapshotAttribute sync request
@param modifySnapshotAttributeRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `modifySnapshotAttributeResponse` the request response data model
*/
-(NSDictionary*) modifySnapshotAttributeSyncWithRequest:(DiskModifySnapshotAttributeRequest*) modifySnapshotAttributeRequest
{
DiskModifySnapshotAttributeExecutor* excutor = [[DiskModifySnapshotAttributeExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:modifySnapshotAttributeRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskModifySnapshotAttributeResponse* response = [[DiskModifySnapshotAttributeResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"modifySnapshotAttributeResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)modifySnapshotAttributeAsyncWithRequest:(DiskModifySnapshotAttributeRequest*) modifySnapshotAttributeRequest
                       completionHandler:(void(^)(int statusCode,DiskModifySnapshotAttributeResponse* _Nullable modifySnapshotAttributeResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskModifySnapshotAttributeExecutor* excutor = [[DiskModifySnapshotAttributeExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:modifySnapshotAttributeRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskModifySnapshotAttributeResponse* response = [[DiskModifySnapshotAttributeResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
deleteSnapshot sync request
@param deleteSnapshotRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `deleteSnapshotResponse` the request response data model
*/
-(NSDictionary*) deleteSnapshotSyncWithRequest:(DiskDeleteSnapshotRequest*) deleteSnapshotRequest
{
DiskDeleteSnapshotExecutor* excutor = [[DiskDeleteSnapshotExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:deleteSnapshotRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDeleteSnapshotResponse* response = [[DiskDeleteSnapshotResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"deleteSnapshotResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)deleteSnapshotAsyncWithRequest:(DiskDeleteSnapshotRequest*) deleteSnapshotRequest
                       completionHandler:(void(^)(int statusCode,DiskDeleteSnapshotResponse* _Nullable deleteSnapshotResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskDeleteSnapshotExecutor* excutor = [[DiskDeleteSnapshotExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:deleteSnapshotRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDeleteSnapshotResponse* response = [[DiskDeleteSnapshotResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
createDisks sync request
@param createDisksRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `createDisksResponse` the request response data model
*/
-(NSDictionary*) createDisksSyncWithRequest:(DiskCreateDisksRequest*) createDisksRequest
{
DiskCreateDisksExecutor* excutor = [[DiskCreateDisksExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:createDisksRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskCreateDisksResponse* response = [[DiskCreateDisksResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"createDisksResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)createDisksAsyncWithRequest:(DiskCreateDisksRequest*) createDisksRequest
                       completionHandler:(void(^)(int statusCode,DiskCreateDisksResponse* _Nullable createDisksResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskCreateDisksExecutor* excutor = [[DiskCreateDisksExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:createDisksRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskCreateDisksResponse* response = [[DiskCreateDisksResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeSnapshots sync request
@param describeSnapshotsRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeSnapshotsResponse` the request response data model
*/
-(NSDictionary*) describeSnapshotsSyncWithRequest:(DiskDescribeSnapshotsRequest*) describeSnapshotsRequest
{
DiskDescribeSnapshotsExecutor* excutor = [[DiskDescribeSnapshotsExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeSnapshotsRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDescribeSnapshotsResponse* response = [[DiskDescribeSnapshotsResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeSnapshotsResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeSnapshotsAsyncWithRequest:(DiskDescribeSnapshotsRequest*) describeSnapshotsRequest
                       completionHandler:(void(^)(int statusCode,DiskDescribeSnapshotsResponse* _Nullable describeSnapshotsResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskDescribeSnapshotsExecutor* excutor = [[DiskDescribeSnapshotsExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeSnapshotsRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDescribeSnapshotsResponse* response = [[DiskDescribeSnapshotsResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
restoreDisk sync request
@param restoreDiskRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `restoreDiskResponse` the request response data model
*/
-(NSDictionary*) restoreDiskSyncWithRequest:(DiskRestoreDiskRequest*) restoreDiskRequest
{
DiskRestoreDiskExecutor* excutor = [[DiskRestoreDiskExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:restoreDiskRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskRestoreDiskResponse* response = [[DiskRestoreDiskResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"restoreDiskResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)restoreDiskAsyncWithRequest:(DiskRestoreDiskRequest*) restoreDiskRequest
                       completionHandler:(void(^)(int statusCode,DiskRestoreDiskResponse* _Nullable restoreDiskResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskRestoreDiskExecutor* excutor = [[DiskRestoreDiskExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:restoreDiskRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskRestoreDiskResponse* response = [[DiskRestoreDiskResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeDisk sync request
@param describeDiskRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeDiskResponse` the request response data model
*/
-(NSDictionary*) describeDiskSyncWithRequest:(DiskDescribeDiskRequest*) describeDiskRequest
{
DiskDescribeDiskExecutor* excutor = [[DiskDescribeDiskExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeDiskRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDescribeDiskResponse* response = [[DiskDescribeDiskResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeDiskResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeDiskAsyncWithRequest:(DiskDescribeDiskRequest*) describeDiskRequest
                       completionHandler:(void(^)(int statusCode,DiskDescribeDiskResponse* _Nullable describeDiskResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskDescribeDiskExecutor* excutor = [[DiskDescribeDiskExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeDiskRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDescribeDiskResponse* response = [[DiskDescribeDiskResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
extendDisk sync request
@param extendDiskRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `extendDiskResponse` the request response data model
*/
-(NSDictionary*) extendDiskSyncWithRequest:(DiskExtendDiskRequest*) extendDiskRequest
{
DiskExtendDiskExecutor* excutor = [[DiskExtendDiskExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:extendDiskRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskExtendDiskResponse* response = [[DiskExtendDiskResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"extendDiskResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)extendDiskAsyncWithRequest:(DiskExtendDiskRequest*) extendDiskRequest
                       completionHandler:(void(^)(int statusCode,DiskExtendDiskResponse* _Nullable extendDiskResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskExtendDiskExecutor* excutor = [[DiskExtendDiskExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:extendDiskRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskExtendDiskResponse* response = [[DiskExtendDiskResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
modifyDiskAttribute sync request
@param modifyDiskAttributeRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `modifyDiskAttributeResponse` the request response data model
*/
-(NSDictionary*) modifyDiskAttributeSyncWithRequest:(DiskModifyDiskAttributeRequest*) modifyDiskAttributeRequest
{
DiskModifyDiskAttributeExecutor* excutor = [[DiskModifyDiskAttributeExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:modifyDiskAttributeRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskModifyDiskAttributeResponse* response = [[DiskModifyDiskAttributeResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"modifyDiskAttributeResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)modifyDiskAttributeAsyncWithRequest:(DiskModifyDiskAttributeRequest*) modifyDiskAttributeRequest
                       completionHandler:(void(^)(int statusCode,DiskModifyDiskAttributeResponse* _Nullable modifyDiskAttributeResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskModifyDiskAttributeExecutor* excutor = [[DiskModifyDiskAttributeExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:modifyDiskAttributeRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskModifyDiskAttributeResponse* response = [[DiskModifyDiskAttributeResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeDisks sync request
@param describeDisksRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeDisksResponse` the request response data model
*/
-(NSDictionary*) describeDisksSyncWithRequest:(DiskDescribeDisksRequest*) describeDisksRequest
{
DiskDescribeDisksExecutor* excutor = [[DiskDescribeDisksExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeDisksRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDescribeDisksResponse* response = [[DiskDescribeDisksResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeDisksResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeDisksAsyncWithRequest:(DiskDescribeDisksRequest*) describeDisksRequest
                       completionHandler:(void(^)(int statusCode,DiskDescribeDisksResponse* _Nullable describeDisksResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskDescribeDisksExecutor* excutor = [[DiskDescribeDisksExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeDisksRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDescribeDisksResponse* response = [[DiskDescribeDisksResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
createSnapshot sync request
@param createSnapshotRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `createSnapshotResponse` the request response data model
*/
-(NSDictionary*) createSnapshotSyncWithRequest:(DiskCreateSnapshotRequest*) createSnapshotRequest
{
DiskCreateSnapshotExecutor* excutor = [[DiskCreateSnapshotExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:createSnapshotRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskCreateSnapshotResponse* response = [[DiskCreateSnapshotResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"createSnapshotResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)createSnapshotAsyncWithRequest:(DiskCreateSnapshotRequest*) createSnapshotRequest
                       completionHandler:(void(^)(int statusCode,DiskCreateSnapshotResponse* _Nullable createSnapshotResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskCreateSnapshotExecutor* excutor = [[DiskCreateSnapshotExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:createSnapshotRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskCreateSnapshotResponse* response = [[DiskCreateSnapshotResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
describeSnapshot sync request
@param describeSnapshotRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `describeSnapshotResponse` the request response data model
*/
-(NSDictionary*) describeSnapshotSyncWithRequest:(DiskDescribeSnapshotRequest*) describeSnapshotRequest
{
DiskDescribeSnapshotExecutor* excutor = [[DiskDescribeSnapshotExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:describeSnapshotRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDescribeSnapshotResponse* response = [[DiskDescribeSnapshotResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"describeSnapshotResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)describeSnapshotAsyncWithRequest:(DiskDescribeSnapshotRequest*) describeSnapshotRequest
                       completionHandler:(void(^)(int statusCode,DiskDescribeSnapshotResponse* _Nullable describeSnapshotResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskDescribeSnapshotExecutor* excutor = [[DiskDescribeSnapshotExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:describeSnapshotRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDescribeSnapshotResponse* response = [[DiskDescribeSnapshotResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}

/**
deleteDisk sync request
@param deleteDiskRequest request param
@return key `statusCode` http request status code type is int
            `dataResult` the http request response data  type is NSData
            `requestError` the request error type is NSError
            `deleteDiskResponse` the request response data model
*/
-(NSDictionary*) deleteDiskSyncWithRequest:(DiskDeleteDiskRequest*) deleteDiskRequest
{
DiskDeleteDiskExecutor* excutor = [[DiskDeleteDiskExecutor alloc] initWithJDCloudClient:self];
    NSDictionary* responseResult = [excutor executeSync:deleteDiskRequest];
    if(responseResult)
    {
        NSData * resultData = [[responseResult objectForKey:@"dataResult"] copy];
        if(resultData)
        {
            NSMutableDictionary* result = [[NSMutableDictionary alloc]initWithDictionary:responseResult];
            
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDeleteDiskResponse* response = [[DiskDeleteDiskResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        [result setValue:response forKey:@"deleteDiskResponse"];
                        return result;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
    }
    return responseResult;
}


-(void)deleteDiskAsyncWithRequest:(DiskDeleteDiskRequest*) deleteDiskRequest
                       completionHandler:(void(^)(int statusCode,DiskDeleteDiskResponse* _Nullable deleteDiskResponse, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
DiskDeleteDiskExecutor* excutor = [[DiskDeleteDiskExecutor alloc] initWithJDCloudClient:self];
    [excutor executeAsync:deleteDiskRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        if(!error&&responseData)
        {
            NSData * resultData = [responseData copy];
            NSError *jsonError;
            NSDictionary* allKeys = [NSJSONSerialization JSONObjectWithData:resultData options:0 error:&jsonError];
            if(!jsonError&& allKeys)
            {
                @try {
                    DiskDeleteDiskResponse* response = [[DiskDeleteDiskResponse alloc]initWithDic:allKeys];
                    if(response)
                    {
                        completionHandler(statusCode,response,responseData,error);
                        return;
                    }
                } @catch (NSException *exception) {
                    if([GlobalConfig isDebug]){
                        NSLog(@"json serialize response data error,info is %@",exception.reason);
                    }
                }
            }
        }
        completionHandler(statusCode,nil,responseData,error);
    }];
}


 /**
 disk common sync request
 @param  jdcloudDataRequest request param
 @return key `statusCode` http request status code type is int
             `dataResult` the http request response data  type is NSData
             `requestError` the request error type is NSError
 */
 -(NSDictionary*) diskCommonSyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                                   url:(NSString*) url
                                                method:(NSString*) method{
    CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    NSDictionary* responseResult = [excutor executeDataSync:jdcloudDataRequest];
    return responseResult;
}

-(void)diskCommonAsyncWithRequest:(JDCloudDataRequest*) jdcloudDataRequest
                                         url:(NSString*) url
                                      method:(NSString*) method
                           completionHandler:(void(^)(int statusCode, NSData* _Nullable responseData,NSError * _Nullable error))completionHandler
{
     CommonExecutor* excutor = [[CommonExecutor alloc] initWithJDCloudClient:self url:url method:method];
    
    [excutor executeDataAsync:jdcloudDataRequest completionHandler:^(int statusCode, NSData * _Nullable responseData, NSError * _Nullable error) {
        completionHandler(statusCode,responseData,error);
    }];
} 

@end
